package stu.khy.action;

import java.io.ByteArrayInputStream;

import org.hibernate.boot.archive.internal.ByteArrayInputStreamAccess;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

import stu.khy.util.RandomNumUtil;
/**
 * 验证码Action
 * @author 86188
 *
 */
public class RandomAction extends BaseAction {

	private static final long serialVersionUID = 1L;
	private ByteArrayInputStream inputStream;
	@Override
		public String execute() throws Exception {
			RandomNumUtil rdnu=RandomNumUtil.Instance();
			this.setInputStream(rdnu.getImage());//取得带有验证码的随机图片
			ActionContext.getContext().getSession().put("random", rdnu.getString());
			return SUCCESS;
		}
	public ByteArrayInputStream getInputStream() {
		return inputStream;
	}
	public void setInputStream(ByteArrayInputStream inputStream) {
		this.inputStream = inputStream;
	}
  
	
}
